﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using Hartley.ApplicationLogic;
using Hartley.DTOs;
namespace WebApplication1
{
    public partial class AddStudent : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnStudentAdd_Click(object sender, EventArgs e)
        {
            string DOB = txtStudentDOB.Text == "" ? "1985-01-01" : txtStudentDOB.Text;
            StudentDTO studentDTO = new StudentDTO { StudentId = Guid.NewGuid(), 
                                                     FirstName=txtStudentFirstName.Text,
                                                     LastName=txtStudentLastName.Text,
                                                     IndexNo=txtStudentIndexNumber.Text,
                                                     House=ddlStudentHouse.SelectedValue,
                                                     DateOfBirth = Convert.ToDateTime(DOB),
                                                     Address=txtStudentPermAddress.Text,
                                                     OrdinaryBatchYear=ddlStudentOLyr.SelectedValue,
                                                     Description=txttxtStudentDesc.Text,
                                                     PhotoPath = fuStudentPhoto.FileName, 
                                                    // ModifiedBy = "Tharsan",
                                                     ModifiedTime = DateTime.Now };
            StudentAL studentAL = new StudentAL();
            studentAL.saveStudent(studentDTO);
        }
    }
}
